package P102_GetDeclared;

import org.junit.Test;

import java.lang.reflect.Method;

/**
 * 适时选择getDeclaredxxx和getxxx
 */
public class GetDeclared {

     static class Foo {
       private void foo() {

        }
    }

    @Test
    public void Test() throws NoSuchMethodException {
        String methodName = "foo";
        Method declaredMethod = Foo.class.getDeclaredMethod(methodName);
        Method method = Foo.class.getMethod(methodName);
    }
}
